<template>
  <div>
    <!-- <img :src="$attrs.src" :num="$attrs.num" class="img" alt="" /> -->
    <!-- <img v-bind="$attrs" class="img" alt="" />
    v-on:事件名=“方法”   v-on="{事件名:方法}"
    v-bind:属性名=“值”   v-bind="{属性名:值}"
    
     -->
    <button @click="btnClick">接收非props传值与方法绑定</button>
    <son-son v-bind="$attrs" v-on="$listeners"></son-son>
  </div>
</template>
<script>
import SonSon from './sonson.vue'
export default {
  components: { SonSon },
  //   props: ['src'],
  //   inheritAttrs: false, // 默认非props属性加入到组件最外层(了解) true:加入到最外层，false不加入到最外层
  data () {
    return {
      obj: {
        a: 1,
        b: 2
      }
    }
  },
  methods: {
    btnClick () {
      this.$listeners.click()
      console.log(this.$attrs, this.$listeners)
    }
  }
}
</script>
<style lang="scss" scoped>
.img {
  width: 100px;
  height: 100px;
}
</style>
